package com.breakfast.fun.view.viewholder;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.breakfast.fun.R;
import com.breakfast.fun.base.BaseViewHolder;
import com.breakfast.fun.data.repository.AbroadRepository;
import com.breakfast.fun.ui.mall.MallDetailActivity;

import butterknife.Bind;

/**
 * Created by yukai on 16/10/17.
 */

public class AbroadItemVH extends BaseViewHolder<AbroadRepository> {
    @Bind(R.id.iv_mall_item)
    ImageView mIvMallItem;
    @Bind(R.id.tv_mall_item_name)
    TextView mTvMallItemName;
    @Bind(R.id.tv_mall_item_price)
    TextView mTvMallItemPrice;
//    @Bind(R.id.tv_mall_item_count)
//    TextView mTvMallItemCount;
//    @Bind(R.id.tv_mall_item_stock)
//    TextView mTvMallItemStock;

    public AbroadItemVH(View v) {
        super(v);
    }

    @Override
    public int getType() {
        return R.layout.item_mall;
    }

    @Override
    public void onBindViewHolder(View view, AbroadRepository obj) {
        mImageUtil.loadUrlImage(obj.data.getImage(), mIvMallItem);
        mTvMallItemName.setText(obj.data.getName());
//        mTvMallItemCount.setText(obj.data.getSellcount()+"");
        mTvMallItemPrice.setText("￥" + obj.data.getPrice());
//        mTvMallItemStock.setText(obj.data.getCount()+"");
        view.setOnClickListener(v -> {
            Intent intent = new Intent(mContext, MallDetailActivity.class);
            intent.putExtra("goodsBean", obj.data);
            mContext.startActivity(intent);
        });
    }
}
